package com.example.bookstore.mapper;

import com.example.bookstore.entity.BookUser;
import com.example.bookstore.form.userform.ChangePwdForm;
import com.example.bookstore.form.userform.UpdateUserForm;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BookUserMapper {

    //用户注册、记得参数转换
    Integer UserRegister(BookUser bookUser);

    //修改密码、userId
    Integer UserChangePwd(ChangePwdForm changePwdForm);

    //用户激活
    Integer ActivityUser(@Param("activityCode") String activityCode, @Param("userId") Integer userId);

    //更新用户信息、userId
    Integer UpdateUser(UpdateUserForm updateUserForm);

    //根据id查询用户
    BookUser SelectUserById(Integer userId);

    //根据userName模糊查询用户
    List<BookUser> SelectUserByName(String userName);

    //删除一个用户
    Integer DeleteUserById(Integer userId);

    //通过userName精确查询用户，用以登录
    BookUser SelectByLoginName(String userName);

    //获取所有用户
    List<BookUser> ShowAllUser();

    //通过电话号码查询用户
    BookUser SelectUserByTel(String telePhone);

}